package com.boot.core.protocol

class QueryRequestOfApp {

    val jsonrpc: String = "2.0"
    var id: String? = null
    var method: String? = null
    var params: QueryParamsOfApp? = null
//    var sign: String? = ""

    fun QueryRequestOfApp(queryRequestOfApp: QueryRequestOfApp?) {
        this.id = queryRequestOfApp?.id
        this.method = queryRequestOfApp?.method
        if (queryRequestOfApp != null) {
            this.params = QueryParamsOfApp(queryRequestOfApp.params)
        }
    }


    class QueryParamsOfApp(queryParamsOfApp: QueryParamsOfApp?) {
        // 此处应看前端传入参数是否为json字符串
        var data: Data? = queryParamsOfApp?.data
        var sign: String? = ""

        class Data(data: Data?) {
            var version: String? = data?.version
            var appId: String? = data?.appId
            var sessionId: String? = data?.sessionId
            var userInfo: UserInfo? = data?.userInfo
            /*
            var transaction: String? = data?.transaction
            var operations: Operations? = data?.operations
            */
            var source: Source? = data?.source
            var dataObjId: String? = data?.dataObjId
            var condition: String? = data?.condition
            var fields: String? = data?.fields
            var orderBy: String? = data?.orderBy
            var page: Page? = data?.page

            class UserInfo(userInfo: UserInfo?) {
                var userId: String? = userInfo?.userId
                var userName: String? = userInfo?.userName
                var userDeptNo: String? = userInfo?.userDeptNo
                var sn: String? = userInfo?.sn
                var sfzh: String? = userInfo?.sfzh
                var extAttr: HashMap<String, Any?>? = userInfo?.extAttr
            }

            class Source(source: Source?) {
                var sourceId: String? = source?.sourceId
            }

            /*class Operations(operations: Operations?) {
                var operationType: Int? = operations?.operationType
                var operationId: String? = operations?.operationId
                var sourceId: String? = operations?.sourceId
                var condition: String? = operations?.condition
                var data: ArrayList<HashMap<String, Any?>?>? = operations?.data
            }*/

            class Page(page: Page?) {
                var pageNo: Int? = page?.pageNo
                var pageSize: Int? = page?.pageSize
                var total: Int? = page?.total
            }
        }

    }

}